<?php
global $_GPC, $_W;
$title = '我的团队';
$cfg = $this->module['config'];
$mem = $this->getMem();
$total = col('select count(1) from ' .tb('mem'). " where agentid='{$mem['id']}' and uniacid='{$_W['uniacid']}' and (avatar != '' or nickname != '')");
if($cfg['commission']['status']>1){
	$levelAgentids2Total = $this->getLevelAgent($mem['id'],1);
	$second = empty($levelAgentids2Total)?0:count($levelAgentids2Total);
	if(!empty($levelAgentids2Total) && $cfg['commission']['status']>2){
		$levelAgentids3Total = array();
		$tmpLevelAgentIdsTotal = array();
		foreach ($levelAgentids2Total as $kl => $vl){
			$level3idsTotal[] = $vl;
		}
		$tmpLevelAgentIdsTotal = getall('select id from ' .tb('mem'). " where uniacid='{$_W['uniacid']}' and agentid in (".implode(',', $level3idsTotal).")");
		foreach ($tmpLevelAgentIdsTotal as $k => $v){
			if(!empty($v))$levelAgentids3Total[] = $v['id'];
		}
		if(!empty($levelAgentids3Total)) {
			$condition1 .= " and id in (".implode(',', $levelAgentids3Total).") ";
		}
		else $condition1 .= " and id = 0 ";
		$third = col('select count(1) from ' . tb('mem') . " where 1 {$condition1} and (avatar != '' or nickname != '')");
	}
}
$share = $this->getShare($mem, $cfg);
include $this->template('mynext');